<template>

  <a-modal class="common-modal" :title="title" :footer="null" :width="550" :scroll="{ y: 440 }" :visible="visible" :confirmLoading="confirmLoading" @cancel="handleCancel" :maskClosable="false" style="top:5%;">
    <a-spin :spinning="false">
      <div  class="pb-20" >
        <a-card :title="$t('other.smartFactoryDataKanban')" >
          <template #extra><a href="#"><span @click="totalTvScreen(1)">{{ $t('other.smartFactoryDataKanban') }}</span></a></template>
        </a-card>
        <a-card :title="$t('other.smartFactoryDataGroupKanban')" >
          <template #extra><a href="#"><span @click="totalTvScreen(2)">{{ $t('other.smartFactoryDataGroupKanban') }}</span></a></template>
        </a-card>
      </div>
    </a-spin>
  </a-modal>
</template>

<script setup>
import {  nextTick, ref } from 'vue'
// import axios from '@/utils/request'
// import { getLocalStorage } from "@/utils";
// import {message} from "ant-design-vue";
// import { store } from "@/store";
// import { CheckCircleFilled ,MinusCircleFilled  } from "@ant-design/icons-vue";
// const emits = defineEmits(['ok'])
let title = ref('')
let visible = ref(false)
let confirmLoading = ref(false)
let formState = ref({})

const totalTvScreen = (val) => {
  let  currentLine = JSON.parse(localStorage.getItem("currentLine"))
  let  locale = localStorage.getItem("locale")
  let protocol = window.location.protocol
  let hostname = window.location.hostname
  let url = ''
  if (val == 1){
    url = protocol+'//'+hostname+':8889/screen1'
  }
  if (val == 2){
    url = `${protocol}//${hostname}${ ':8889/screen2' }?lineNo=${currentLine.lineNo}&lang=${locale}`
  }
  if(val == 3) {
    url = `${protocol}//${hostname}${ ':8889/screen3' }?lineNo=${currentLine.lineNo}&lang=${locale}`
  }
  window.open(url)
  handleCancel()
}
const open = async () => {
  await initModal()
  await nextTick()
}
const initModal = async () => {
  title.value = '看板列表'
  visible.value = true
}
const handleCancel = () => {
  formState.value = {}
  visible.value = false
}
defineExpose({
  open
})
</script>